//
//  DDSeverTableCell.m
//  PrivateCloud
//
//  Created by sarah doo on 13-10-14.
//  Copyright (c) 2013年 sarah doo. All rights reserved.
//

#import "DDSeverTableCell.h"

@implementation DDSeverTableCell
@synthesize nameLabel, button, isSelectButton, model;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
//        isSelectButton = NO;
        [self createStaticView];
    }
    return self;
}

- (void)createStaticView {
    //self.isSelectButton = NO;
    nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, [[UIScreen mainScreen] bounds].size.width - 100, 44)];
    nameLabel.textColor = [UIColor blackColor];
    nameLabel.font = [UIFont systemFontOfSize:10];
    [self.contentView addSubview:nameLabel];
    
    button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake([[UIScreen mainScreen] bounds].size.width - 50, 0, 40, 40);
    [button setImage:[UIImage imageNamed:@"check_false.png"] forState:UIControlStateNormal];
    button.userInteractionEnabled = false;
    [self.contentView addSubview:button];
}

- (void)setModel:(DDSeverTableModel *)_model {
    if (model != _model) {
        [model release];
        model = [_model retain];
    }
    nameLabel.text = model.titleName;
    if (model.isSelected) {
        [button setImage:[UIImage imageNamed:@"check_true.png"] forState:UIControlStateNormal];
    } else {
        [button setImage:[UIImage imageNamed:@"check_false.png"] forState:UIControlStateNormal];
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
}

-(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{
    NSLog(@"server--------------");
    return true;
}

//-(void)
@end
